package com.lkj;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Component
@ConfigurationProperties(prefix = "swjg")
public class ApplicationConfig {

    private static String dtdm;

    private static String dtmc;


    private static String getDtdm() {
        return dtdm;
    }

    public  void setDtdm(String dtdm) {
        ApplicationConfig.dtdm = dtdm;
    }

    private static String getDtmc() {
        return dtmc;
    }

    public  void setDtmc(String dtmc) {
        ApplicationConfig.dtmc = dtmc;
    }

    public static String getDtdms(String dtmc){

        String dtdms = getDtdm();
        String dtmcs = getDtmc();

        List<String> list = Arrays.asList(dtdms.split(","));

        List<String> list1 = Arrays.asList(dtmcs.split(","));
        System.out.println(list1);
        String result = "";
        for (int i = 0; i < list1.size(); i++) {

            String s = list1.get(i);

            if (s.contains(dtmc)) {
                result = list.get(i);
            }
        }

        return result;
    }
}
